<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>

</head>
<body>
<div class="ui container">
    <div class="ui attached segment">
        <form th:action="@{/user/}" method="post" style="display: inline-block !important;">
            <input type="text" name="name" placeholder="输入用户名查找">
            <input type="submit" value="搜索">
        </form>
        <a th:href="@{/user/update}" class="ui button mini teal" style="margin-left: 30px !important;">新增</a>
        <a th:href="@{/user/employee/all}" class="ui button mini teal" style="margin-left: 30px !important;">员工管理</a>
        <a th:href="@{/user/file}" class="ui button mini teal" style="margin-left: 30px !important;">照片上传</a>
        <a th:href="@{/user/login}" class="ui button mini teal" style="margin-left: 30px !important;">登录</a>
    </div>
    <table class="ui celled attached table" style="margin-top: 40px !important;">
        <thead>
        <tr><th>id</th>
            <th>姓名</th>
            <th>密码</th>
            <th>操作</th>
        </tr></thead>
        <tbody id="tbody">
        <tr th:each="user : ${page.list}">
            <td th:text="${user.id}">James</td>
            <td th:text="${user.name}">24</td>
            <td th:text="${user.pwd}">Engineer</td>
            <td>
                <a th:href="@{/user/edit/{id}(id=${user.id})}" class="ui button mini pink">编辑</a>
                <a th:href="@{/user/delete/{id}(id=${user.id})}" class="ui button mini teal">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="ui attached segment" >
        <table class="m-mobile-wide" width="425px">
            <tbody id="fenye">
            <tr align="center">
                <td><a th:href="@{/user/(pageNum=${page.pageNum}-1)}"  class="ui button basic mini" th:unless="${page.isFirstPage}">上一页</a></td>

                <td>
                    第
                    <h8 th:text="${page.pageNum}">2</h8>
                    页/共
                    <h8 th:text="${page.pages}">4</h8>
                    页
                    共
                    <h8 th:text="${page.total}">29</h8>
                    条
                </td>
                <td>
                    <form name="pageForm" th:action="@{/user/}" method="get">
                        <div class="ui mini input ">
                            <input type="text" class="m-bg" name="pageNum" placeholder="页码" style="width: 50px!important; height: 27.76px!important;" required>
                            <button type="submit" style="font-size: 11px!important;width: 30px!important; height: 0px!important; border: none;margin: 5px;padding: 0;" class="button mini">
                                跳转
                            </button>
                        </div>
                    </form>
                </td>
                <td> &nbsp;</td>
                <td  style="float: right">
                    <a th:href="@{/user/(pageNum=${page.pageNum}+1)}" class="ui button basic mini " style="float: right;" th:unless="${page.isLastPage}">下一页</a>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div class="ui success  message" th:unless="${#strings.isEmpty(message)}">
        <i class="close icon"></i>
        <div class="header">提示：</div>
        <p th:text="${message}"></p>
    </div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<script>
    $(".message .close").on('click',function () {
        $(this).closest(".message")
            .transition("fade");
    })
</script>
</body>
</html>